package xhwl.insurance.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class DateUtil {
	public static String getYearMonth(String input,int type,int month) {  
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Calendar calendar = Calendar.getInstance();
        try {
			Date date=sdf.parse(input);
			calendar.setTime(date); 
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
        if(type==0){//加
        	calendar.add(Calendar.MONTH, month);
        }
        else {
        	calendar.add(Calendar.MONTH, -month);
		}
        return sdf.format(calendar.getTime());  
    }  
}
